package com.yang.project.base.stream;

import jdk.nashorn.internal.ir.annotations.Immutable;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class StreamTest {
    @Test
    public void test01() {
        List<String> list = new ArrayList<>();
        list.add("zhangsan");
        list.add("lisi");
        list.add("wangwu");
        List<Integer> collect = list.stream().map(String::length).collect(Collectors.toList());
        System.out.println(collect);
    }

    @Test
    public void test02() {
        List<String> list = new ArrayList<>();
        list.add("zhangsan");
        list.add("lisi");
        list.add("wangwu");
        List<String> collect = list.stream().filter(word -> word.length() > 5).collect(Collectors.toList());
        System.out.println(collect);
    }
}
